/**
 * 1
 *  
 * @Author : Ruoyu Wang
 * @DateTime : 24-9-19 下午6:53
 */

#include <iostream>

using namespace std;

int main() {
    long long q, n, m, k;
    cin >> q;
    while (q--) {
        cin >> n >> m >> k;
        long long res = 0;
        if (k <= n - 1) {
            res += (1 + k) * k * m / 2;
        } else if (k <= n + m - 2) {
            res += n * (n - 1) * m / 2;
            k -= n - 1;
            res += k * (n - 1) * m + (1 + k) * k / 2;
        } else {
            res += n * (n - 1) * m / 2;
            k -= n - 1;
            res += (m - 1) * (n - 1) * m + m * (m - 1) / 2;
            k -= m - 1;
            long long tmp;
            tmp = 2 * n * m - 3;
            res += tmp * k / 2;
            if (k % 1) {
                res += n * m - 2;
            }
        }
        cout << res << endl;
    }
    return 0;
}